package h0731;

import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;
import java.util.StringJoiner;

/**
 * @author 不知名帅哥
 * @version 1.0
 * @description 整型数组按个位值排序
 * @date 2024/7/31 23:42
 */
public class SortIntegerArray {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        String[] split = sc.nextLine().split(",");
        //直接比较最后一位
        //TODO 没有那么复杂，直接按照字符的ASCII码比较就行
        Arrays.sort(split, (o1, o2) -> {
            char a = o1.charAt(o1.length() - 1);
            char b = o2.charAt(o2.length() - 1);
            return a - b;
        });

        StringJoiner joiner = new StringJoiner(",");
        for (int i = 0; i < split.length; i++) {
            joiner.add(split[i]);
        }
        System.out.println(joiner);

    }
}
